package coml.jiyun.hp.mvpextract.base;

import java.util.ArrayList;

public abstract class BasePresenter <V extends BaseView>{

    public V baseView;
    private ArrayList<BaseModel> models = new ArrayList<>();

    public  void binView(V baseView){
        this.baseView = baseView;
    };

    public void onDestroy() {
        if (models != null && models.size() > 0 ){
            for (int i = 0; i < models.size(); i++) {
                models.get(i).Destroy();
            }
        }
    }

    public void addModel(BaseModel baseModel){
        models.add(baseModel);
    }

    public BasePresenter(){
        initModel();
    }

    protected abstract void initModel();

}